<script src="<?php echo yii::app()->theme->baseUrl;  ?>/assets/js/indicenter.js"></script>
	<div class="indi-center-bg">
		<div class="indi-center">
			<div class="indi-center-box">
				<h2>个人中心</h2>
				<div class="indi-center-content clearfix">

					<?php include $this->getViewFile('//layouts/user/left') ?>


					<div class="indi-center-con-r">
						<div class="indi-center-con-r-top">
							<span >我的消息</span>
							<a href="<?php echo $this->createUrl('/front/articles/index', array('id' => 357)) ?>" >常见问题</a>
							<a href="" class="indi-ccrt-problom">【客服】有问题请联系我们</a>
						</div>
						<div class="indi-center-con-r-middle">
							<input type="checkbox" class="chooseAll">
							<label for="">全选</label>
							<span class="indi-center-delete">删除</span>
							<span class="indi-center-read">全部标为已读</span>
						</div>
						<div class="indi-center-con-r-bottom">
							<div class="indi-center-choose">
								<?php  foreach ($data['data'] as $key => $rs) { ?>
								<div class="clearfix indi-center-ch">
									<label for="choose" class="indiChoose"></label>
									<div class="indi-center-cb">
										<input name="id"  value="<?php echo $rs['MessageID'] ?>" type="checkbox" class="choose" >
									</div>
									<dl class="clearfix">
										<?php  if(!empty($rs['Image'])){ ?>
										<dt>
											<img src="<?php echo $rs['Image'] ?>" alt="">
										</dt>
										<?php } ?>
										<dd>
											<p style="<?php if($rs['IsRead'] == 0){ echo "color:red";} ?>" ><?php echo $rs['Title'] ?></p>
											<a class="show" href="javascript:void(0)">查看详情</a>
											<input type="hidden" class="title" name="" value="<?php echo $rs['Title'] ?>"/>
											<input type="hidden" class="content" name="" value="<?php echo $rs['Content'] ?>"/>
											<div>
												<span><?php echo date('Y-m-d H:i:s',$rs['AddTime']) ?></span>
												<a href=""><?php echo MessageModel::getTypeHtml($rs['Type']) ?></a>
											</div>
										</dd>
									</dl>
								</div>
								<?php } ?>

							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

<link rel="stylesheet" href="<?php echo yii::app()->theme->baseUrl;  ?>/assets/statics/js/artDialog6/css/ui-dialog.css">
<script src="<?php echo yii::app()->theme->baseUrl;  ?>/assets/statics/js/artDialog6/js/dialog-min.js"></script>
<script type="text/javascript">
	$(function(){
		$(".show").click(function(){
			var title = $(this).next().val();
			var content = $(this).next().next().val();
			tips = dialog({
				fixed: true,
				cancelDisplay: false,
				title:title,
				content:content,
			}).show();				
		})

		LOCK = false;
		$(".indi-center-delete,.indi-center-read").click(function(){
			tips = dialog({
				fixed: true,
				cancelDisplay: false
			});					
			if(LOCK){
				tips.title('还有正在提交的');
				tips.showModal();
				return false;
			}else{
				LOCK = true;
				tips.title('正在提交');
			}
			var data = [];
			var obj = $("input[name='id']:checked");
			length = obj.length;

			for(var i=0;i<length;i++){
				data[i] = obj.eq(i).val();
			}
			var type = '';
			if($(this).attr('class') == 'indi-center-delete'){
				type = 1;
			}else{
				type = 2;
			}
			$.post('<?php echo $this->createUrl("updateMessage") ?>',{id:data,type:type},function(data){
				LOCK = false;
				if(data.status){
					tips.title('提交成功');
					window.location.reload();
				}else{
					tips.title('提交失败');
					tips.content(data.info);
				}				
			},'json');
					
		})



	})
</script>

